package com.zhangfei.service;

import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class AsyncServiceImpl implements AsyncService {



    @Override
    @Async("asyncServiceExecutor")
    public void executeAsync() {
        int i = 5;
        while(i > 0){
            i--;
            log.info("execute task");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
                Thread.currentThread().interrupt();
            }
        }
    }
}